import time
f=open('m1_sorted.txt','r')
N=5000
a=[]*N
m=0
for i in range(5000):
    a.append(int(f.readline()))
f=time.time()
for i in range(N-1):
    for j in range(N-i-1):
        if a[j] > a[j+1]:
            a[j], a[j+1] = a[j+1], a[j]
f2=time.time()
super_time=f2-f
fu=open('m2_reverse.txt','r')
N=5000
a=[]*N
m=0
for i in range(5000):
    a.append(int(fu.readline()))
f3=time.time()
for i in range(N-1):
    for j in range(N-i-1):
        if a[j] > a[j+1]:
            a[j], a[j+1] = a[j+1], a[j]
f4=time.time()
super_time2=f4-f3
fart=open('m3_shuffle.txt','r')
N=1000
a=[]*N
m=0
for i in range(1000):
    a.append(int(fart.readline()))
f8=time.time()
i = 0
for i in range(N-1):
    for j in range(N-i-1):
        if a[j] > a[j+1]:
            a[j], a[j+1] = a[j+1], a[j]
f9=time.time()
super_time3=f9-f8
print(round(super_time*1000),round(super_time2*1000),round(super_time3*1000))
